<script setup lang="ts" name="PersonComponent">
// 语法糖setup相当于return了
// 直接写变量不是响应式的
let name = 'setup中定义变量';
let age = 20;
let tel = '123456789';
// 方法
const call = () => {
  name = '改变name';
  age++;
  alert('打电话' + tel);
};
</script>
<template>
  <div class="person">
    <h2>姓名：{{ name }}</h2>
    <h2>年龄{{ age }}</h2>
    <button @click="call"></button>
  </div>
</template>

<style scoped>
.person {
  color: red;
}
</style>
